package com.zk.shop.service.impl;

import com.github.pagehelper.PageHelper;
import com.sun.tracing.dtrace.ModuleName;
import com.zk.shop.mapper.ManagerMapper;
import com.zk.shop.pojo.Manager;
import com.zk.shop.pojo.ManagerMenu;
import com.zk.shop.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 管理员实现类
 * @param manager
 * @return
 */
@Service
@Transactional
public class ManagerServiceImpl implements ManagerService {

    @Autowired
    protected ManagerMapper managerMapper;

    @Override
    public Manager login(Manager manager) {
        return managerMapper.login(manager);
    }

    @Override
    public Integer pushManager(Manager manager) {
        return managerMapper.pushManager(manager);
    }

    @Override
    public Integer removeManager(Integer mid) {
        return managerMapper.removeManager(mid);
    }

    @Override
    public Integer saveLoginStatus(Manager manager) {
        return managerMapper.saveLoginStatus(manager);
    }

    @Override
    public Integer savePassword(Manager manager) {
        return managerMapper.savePassword(manager);
    }

    @Override
    public Integer saveRole(Integer mrole, String mid) {
        return managerMapper.saveRole(mrole, mid);
    }

    @Override
    public Integer saveListRole(Integer mrole, List<Manager> arrs) {
        return managerMapper.saveListRole(mrole, arrs);
    }

    @Override
    public List<Manager> manageTableList(Manager manager,Integer page,Integer size) {
        PageHelper.startPage(page,size);
        return managerMapper.manageTableList(manager);
    }

    @Override
    public Integer getLoginStatusI(Integer mid) {
        return managerMapper.getLoginStatusI(mid);
    }

    @Override
    public Integer setPwd(Manager manager) {
        return managerMapper.setPwd(manager);
    }

    @Override
    public Integer updateLoginStatus(Manager manager) {
        return managerMapper.updateLoginStatus(manager);
    }

    @Override
    public List<ManagerMenu> getMenuTree(Integer managerid) {
        return managerMapper.getMenuTree(managerid);
    }
}
